﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KCMS.BusinessLogic.Interfaces;
using StructureMap;
using AutoMapper;

namespace KCMS.Controllers
{
    public class ProductImageController : Controller
    {
        //
        // GET: /ProductImage/
        private IProductImageService pService = ObjectFactory.GetInstance<IProductImageService>();
        public ActionResult Index()
        {
            return View();
        }
        public PartialViewResult ShowThumbImage(Guid productId)
        {
            IEnumerable<BusinessLogic.Models.ProductImage> image = pService.getByProductId(productId);

            var model = Mapper.Map<IEnumerable<BusinessLogic.Models.ProductImage>,IEnumerable<KCMS.Web.Models.ProductImageViewModel>>(image);
            return PartialView(model);
        }
        public PartialViewResult ShowImage(Guid productId)
        {
            IEnumerable<BusinessLogic.Models.ProductImage> image = pService.getByProductId(productId);
            var model = Mapper.Map<IEnumerable<BusinessLogic.Models.ProductImage>,IEnumerable<KCMS.Web.Models.ProductImageViewModel>>(image);
            return PartialView(model);
        }
        

    }
}
